package com.itheima.d7_interface_demo;

import java.util.ArrayList;

public class StudentOperatorImpl2 implements StudentOperator{
    @Override
    public void printAllInfo(ArrayList<Student> stus) {
//        打印班级全部学生信息，包含男女人数
        System.out.println("----------------------------");
        for (int i = 0; i < stus.size(); i++) {
            Student student = stus.get(i);
            //打印全部信息
            System.out.println(student.toString());
        }
        System.out.println("------------------");
    }

    @Override
    public void printAvgScore(ArrayList<Student> stus) {
        //d打印全班平均成绩
        double AllScore = 0.0;
        for (int i = 0; i < stus.size(); i++) {
            Student student = stus.get(i);
            //获取所有成绩
           AllScore += student.getScore();
           //获取最大值
        }
        System.out.println("学生平均成绩是"+AllScore/stus.size());
    }
}
